import {h, defineComponent} from 'vue';
const ItemRender = defineComponent({
    name: 'itemRender',
    inheritAttrs: false,
    props: {
        record: {
            type:Object,
            default:[]
        },
        index:{
            type: Number,
            default: 0
        },
        customRender:{
            type: Function,
            default: ()=>{}
        },
        dataIndex:{
            type: String,
            default: ""
        }
    },
    setup(props, { attrs, slots, expose }) {
        return () => {
            const customRender =  props.customRender(props);
            if(customRender){
                return customRender;
            }else{
                return props.record[props.dataIndex]
            }
        };
    },
});

export default ItemRender;